Skip to content

Conversation

@albertomercurio
Copy link
Member

@albertomercurio albertomercurio commented Apr 5, 2025

Checklist

Thank you for contributing to QuantumToolbox.jl! Please make sure you have finished the following tasks before opening the PR.

  • Please read Contributing to Quantum Toolbox in Julia.
  • Any code changes were done in a way that does not break public API.
  • Appropriate tests were added and tested locally by running: make test.
  • Any code changes should be julia formatted by running: make format.
  • All documents (in docs/ folder) related to code changes were updated and able to build locally by running: make docs.
  • (If necessary) the CHANGELOG.md should be updated (regarding to the code changes) and built by running: make changelog.

Request for a review after you have completed all the tasks. If you have not finished them all, you can also open a Draft Pull Request to let the others know this on-going work.

Description

Here I do a small change in the generation of a fock state, using comprehension instead of creating a zero vector and then mutating one element. This would support Zygote.jl differentiation, as it doesn't support mutating arrays.

@albertomercurio albertomercurio requested a review from ytdHuang April 5, 2025 13:02
@ytdHuang
Copy link
Member

ytdHuang commented Apr 5, 2025

@albertomercurio
oh
I clicked the wrong button (approve).

But I just want to say that the tests are failing.

@albertomercurio
Copy link
Member Author

Yes there was a typo. It should work now

@albertomercurio
Copy link
Member Author

OK, I was too lazy not to run the tests locally. Let me do it, and then I’ll push it.

@ytdHuang
Copy link
Member

ytdHuang commented Apr 5, 2025

@albertomercurio

Should it be i == (j+1) ?

By the way, I was thinking, would it be more efficient if we just create the sparse one, and then do to_dense if sparse = false.

@albertomercurio
Copy link
Member Author

Yes, indeed. Just pushed right now.

@codecov
Copy link

codecov bot commented Apr 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.39%. Comparing base (d8f83cc) to head (6da162c).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #438      +/-   ##
==========================================
- Coverage   94.39%   94.39%   -0.01%     
==========================================
  Files          47       47              
  Lines        2998     2997       -1     
==========================================
- Hits         2830     2829       -1     
  Misses        168      168              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@albertomercurio
Copy link
Member Author

I don't know why the format test failed. Everything is formatted, and it is detecting non formatted files that I didn't touch in this PR

@albertomercurio
Copy link
Member Author

The format error is due to the update of JuliaFormatter.jl. This will be fixed in a separate PR

@albertomercurio albertomercurio merged commit 5fbce6d into qutip:main Apr 5, 2025
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants